//
//  GFButtonScrollView.m
//  Qyer
//
//  Created by dlios on 15/10/20.
//  Copyright (c) 2015年 GF. All rights reserved.
//

#import "GFButtonScrollView.h"

@implementation GFButtonScrollView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        NSArray *buttonTitleArray = @[@"游记", @"攻略"];
        for (int i = 0; i < 2; i++) {
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            [button setFrame:CGRectMake((SCREEN_WIDTH / 2) * WIDTH * i, 5 * HEIGHT, (SCREEN_WIDTH / 2), 40 * HEIGHT)];
            [button setBackgroundColor:[UIColor clearColor]];
            [button.titleLabel setFont:[UIFont systemFontOfSize:WIDTH * 14.]];
            [button setTitle:[buttonTitleArray objectAtIndex:i] forState:UIControlStateNormal];
            [button setTitleColor:[NightMode shareNightModeHandle].wordColor forState:UIControlStateNormal];
            [button setTag:1000 + i];
            [button addTarget:self action:@selector(buttonClick:)
             forControlEvents:UIControlEventTouchUpInside];
            [self addSubview:button];
        }
    }
    return self;
}

- (void)buttonClick: (UIButton *)sender{
    [self.buttonDelegate setAInteger:(sender.tag - 1000)];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
